<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>登录</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="image/favicon1.ico" rel="shortcut icon">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<jsp:include page="/scripts/common/index.html"></jsp:include>
<jsp:include page="/scripts/dhtmlx/index.html"></jsp:include>
<jsp:include page="/scripts/jquery/index.html"></jsp:include>
<jsp:include page="/scripts/bootstrap/index.html"></jsp:include>
<link rel="stylesheet" href="${basePath }style/default.css">
</head>
<script type="text/javascript">
var temp=false;
function init(){
	createCode();
}
function doLogin() {
	if(true){
		$.ajax({
			type : 'POST' ,
			url : 'page/system/manage/Login/doLogin' ,
			data : $('#MyForm').serialize() ,
			dataType : "json" ,
			async : true ,
			cache : false ,
			jsonpCallback : "null" ,
			success : function(response, status, statusText) {
				//alert(response + ":" + status + ":" + statusText);
				location.href = "${basePath}page/system/manage/Index/";
			} ,
			error : function(response, status, statusText) {
				//alert(response + ":" + status + ":" + statusText);
			} ,
			complete : function(response, status, statusText) {
				//alert(response + ":" + status + ":" + statusText);
			}
	});
	}
}
function checkUser(){
	var userAccount=document.getElementById("u").value; 
	var userV=/^[a-zA-Z]{1}[a-zA-Z0-9]{2,29}$/;
	if (!userV.exec(userAccount)){
		$("#u").attr("value","");
		$("#u").attr("placeholder","请输入正确登录名");
		document.getElementById("u").style.borderColor="#843534";
		return false;
	  }
	  document.getElementById("u").style.borderColor="#3c763d";
	  return true;
	}

function checkPwd(){
	var pwd=document.getElementById("password").value; 
	var pwdV=/^[a-zA-Z0-9_]{6,10}$/;  
	 if(!pwdV.exec(pwd)){
		$("#password").attr("value","");
		$("#password").attr("placeholder","请输入正确密码");
		document.getElementById("password").style.borderColor="#843534";
		return false;
	  }
	  document.getElementById("password").style.borderColor="#3c763d";
	  return true;
	}

function checkCode(){
	var code=document.getElementById("inputCode").value;  
	if(code==""||code==null){
		$("#inputCode").attr("value","");
		$("#inputCode").attr("placeholder","");
		document.getElementById("inputCode").style.borderColor="#843534";
		return false;
	  }
	  document.getElementById("inputCode").style.borderColor="#3c763d";
	  return true;
	}

function checkall(){
	if(checkUser()==false||checkPwd()==false||checkUser()==false){
		return false
		}
		return true;
	}
function show(o){
	var obj=document.getElementById(o);
	obj.value="";
	obj.style.borderColor="#66AFE9";
	}
</script>
<script language="javascript" type="text/javascript">

    var code;
    function createCode() {
    	 var inputReg = document.getElementById("inputCode");
    	 inputReg.value="";
        code = "";
        var codeLength = 4; //验证码的长度
        var checkCode = document.getElementById("checkCode");
        var c2 = document.getElementById("c2");
        var codeChars = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 
        'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
        'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); //所有候选组成验证码的字符，当然也可以用中文的
        for (var i = 0; i < codeLength; i++) 
        {
            var charNum = Math.floor(Math.random() * 52);
            code += codeChars[charNum];
        }
        if (checkCode) 
        {
            checkCode.className = "code";
            checkCode.innerHTML = code;
            c2.value=code;
        }
    }
    function retrievePassword(){
    	//location.href = "${basePath}page/system/manage/RetrievePassword/";
    	SN.getWindowByUrl("找回密码", "500", "380", "${basePath}page/system/manage/Login/toGetPassword", {});
    }
 </script>
<style type="text/css">
.code
{
      /*   background:url(code_bg.jpg); */
        font-family:Arial;
        font-style:italic;
         color:#71706d;
         font-size:30px;
         border:0;
         padding:2px 3px;
         letter-spacing:3px;
         font-weight:bolder;             
         float:left;            
         cursor:pointer;
         width:90px;
         height:25px;
         float:left;
         line-height:25px;
         text-align:center;
         vertical-align:middle;

}
b
{
    text-decoration:none;
    font-size:12px;
    color:#71706d;
    }
a:hover
{
   text-decoration:underline;
    }
</style>
     <style>
.createCode{
	color: #71706d;
}
.createCode:hover{
	cursor: pointer;
	color: blue;
	text-decoration: underline;
}

</style>
<body style="background:#ffffff" onload="init();">
	<form class="form-horizontal MyForm" id="MyForm" name="MyForm" method="post" target="MyFrame" enctype="multipart/form-data">
		
		<div style="background:url(${basePath}image/loginBackground.jpg);width:100%;height:97%;border:1px solid #ffffff;text-align:center;">
			<div style="margin-top: 10%">
				<span style="color:#0099cc;font-size:33px;font-weight: bold;font-family: Arial, '微软雅黑', '宋体'">信息资源应用门户</span>
				<!-- <span style="color:#71706d;font-weight:bold;font-size:26px;position:relative;left:50px">电子标书管理系统</span> -->
			</div>
			<table border="0" style="background:url(${basePath}image/back.png);width:560px;min-height:340px;border:0px solid red;margin:auto;">
				<tr>
					<td>
						<div style="border:0px solid #dbdbdb;width:130px;height:130px;margin-left:25%;margin-top:25%" align="center">
							<!-- <span style="position:relative;top:30%;color:#dbdbdb;font-size:35px;font-weight:bold">logo</span> -->
							<img src="${basepath}image/logo1.jpg" style="width:120px;max-height:80px;min-height:120px;height:120px;margin-left:5%;margin-top:-6px;" />
						</div>
					</td>
					<td>
						<div class="tableCont" style="width: 90%;margin-top: 40px;padding: 0px;">
							<div class="form-group">
								<label class="col-xs-3 control-label" for="userAccount">登录名:</label>
								<div class="col-xs-6 ">
									<input class=" form-control" type="text" id="u" name="u" placeholder=""  onblur="checkUser()" onfocus="show('u')"/>
								</div>
								<div class="col-xs-1 ">
									<span class="required">*</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-xs-3 control-label" for="password">密码:</label>
								<div class="col-xs-6 ">
									<input type="input" onfocus="this.type='password'" id="password" class="form-control" name="p" value="" autocomplete="off" placeholder=""  onblur="checkPwd()" onfocus="show('password')"/>
								</div>
								<div class="col-xs-1 ">
									<span class="required">*</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-xs-3 control-label" for="VerificationCode">验证码:</label>
								<div class="col-xs-3 ">
									<input type="text" class="form-control"  id="inputCode" clientidmode="Static" name="c" value="" onblur="checkCode()" onfocus="show('inputCode')">
								</div>
								<div class="col-xs-1 ">
									<span class="required">*</span>
								</div>
								<div class="col-xs-3 ">
									<span style="height:25px">${code }</span>
									<input type="hidden" class="form-control" id="c2" name="c2"/>
									<div class="code" id="checkCode" onclick="createCode()" ></div>
								</div>
							</div>
							<div class="form-group" style="margin-bottom: 0px">
								<div class="col-xs-5 "></div>
								<div class="col-xs-6 ">
									<span style="float:right;width:75%"><span class="createCode"  onclick="createCode()">看不清楚换一张？</span></span>
								</div>
							</div>
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="right" style="height:10px;">
						<hr style="width:91.5%;border:1px solid #dbdbdb;">
					</td>
				</tr>
				<tr>
					<td><div style="margin-bottom:65px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onclick="retrievePassword()"></a></div></td>
					<td colspan="2" align="center">
						<button type="button" class="btn btn-primary" style="width:100px;margin-bottom:20%;background-color:#0099cc;color:#fff" onclick="doLogin()">登录</button> <input type="reset" class="btn btn-primary" style="width:100px;margin-bottom:20%;background-color:#0099cc;color:#fff" value="重置" />
					</td>
				</tr>
			</table>
		</div>
	</form>
	<div style="display: none;">
		<iframe></iframe>
	</div>
</body>
</html>
